//
//  leveLayer.m
//  mmtouch
//
//  Created by xing lion on 11-9-6.
//  Copyright 2011年 tencent. All rights reserved.
//

#import "leveLayer.h"
#import "PlayLayer.h"
#import "SceneManager.h"
@implementation leveLayer

-(void)gotoPlay:(id)sender
{
    
    int picnum = [sender tag];

	CCLayer *layer = [PlayLayer node];
    [(PlayLayer*)layer gotonextMM :picnum];
	[SceneManager go: layer];
}


-(void)makebutton1
{

    CCSprite* menupic = [CCSprite spriteWithFile:@"1.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen1 setTag:1];
    
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"2.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen2 setTag:2];
    
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"3.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen3 setTag:3];
    
    CCSprite* menupic4 = [CCSprite spriteWithFile:@"4.png"];
    
    CCMenuItemSprite *spmen4 = [CCMenuItemSprite itemFromNormalSprite:menupic4 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen4 setTag:4];
    CCSprite* menupic5 = [CCSprite spriteWithFile:@"5.png"];
    
    CCMenuItemSprite *spmen5 = [CCMenuItemSprite itemFromNormalSprite:menupic5 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen5 setTag:5];
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,spmen4,spmen5, nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 450)];
    
    [self addChild:menu];
    
}

-(void)makebutton2
{
    
    
    CCSprite* menupic = [CCSprite spriteWithFile:@"6.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen1 setTag:6];
    
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"7.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen2 setTag:7];
    
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"8.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen3 setTag:8];
    
    CCSprite* menupic4 = [CCSprite spriteWithFile:@"9.png"];
    
    CCMenuItemSprite *spmen4 = [CCMenuItemSprite itemFromNormalSprite:menupic4 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen4 setTag:9];
    
    CCSprite* menupic5 = [CCSprite spriteWithFile:@"10.png"];
    
    CCMenuItemSprite *spmen5 = [CCMenuItemSprite itemFromNormalSprite:menupic5 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen5 setTag:10];
    
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,spmen4,spmen5, nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 390)];
    
    [self addChild:menu];
}

-(void)makebutton3
{
    CCSprite* menupic = [CCSprite spriteWithFile:@"11.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen1 setTag:11];
    
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"12.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen2 setTag:12];
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"13.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen3 setTag:13];
    CCSprite* menupic4 = [CCSprite spriteWithFile:@"14.png"];
    
    CCMenuItemSprite *spmen4 = [CCMenuItemSprite itemFromNormalSprite:menupic4 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen4 setTag:14];
    CCSprite* menupic5 = [CCSprite spriteWithFile:@"15.png"];
    
    CCMenuItemSprite *spmen5 = [CCMenuItemSprite itemFromNormalSprite:menupic5 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen5 setTag:15];
    
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,spmen4,spmen5, nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 330)];
    
    [self addChild:menu];
}

-(void)makebutton4
{
    CCSprite* menupic = [CCSprite spriteWithFile:@"16.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen1 setTag:16];
    
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"17.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen2 setTag:17];
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"18.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen3 setTag:18];
    CCSprite* menupic4 = [CCSprite spriteWithFile:@"19.png"];
    
    CCMenuItemSprite *spmen4 = [CCMenuItemSprite itemFromNormalSprite:menupic4 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen4 setTag:19];
    CCSprite* menupic5 = [CCSprite spriteWithFile:@"20.png"];
    
    CCMenuItemSprite *spmen5 = [CCMenuItemSprite itemFromNormalSprite:menupic5 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen5 setTag:20];
    
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,spmen4,spmen5, nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 270)];
    
    [self addChild:menu];
}

-(void)makebutton5
{
    CCSprite* menupic = [CCSprite spriteWithFile:@"21.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen1 setTag:21];
    
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"22.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen2 setTag:22];
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"23.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen3 setTag:23];
    CCSprite* menupic4 = [CCSprite spriteWithFile:@"24.png"];
    
    CCMenuItemSprite *spmen4 = [CCMenuItemSprite itemFromNormalSprite:menupic4 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen4 setTag:24];
    CCSprite* menupic5 = [CCSprite spriteWithFile:@"25.png"];
    
    CCMenuItemSprite *spmen5 = [CCMenuItemSprite itemFromNormalSprite:menupic5 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    
    [spmen5 setTag:25];
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,spmen4,spmen5, nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 210)];
    
    [self addChild:menu];
}

-(void)makebutton6
{
    CCSprite* menupic = [CCSprite spriteWithFile:@"26.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen1 setTag:26];
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"27.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen2 setTag:27];
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"28.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen3 setTag:28];
    CCSprite* menupic4 = [CCSprite spriteWithFile:@"29.png"];
    
    CCMenuItemSprite *spmen4 = [CCMenuItemSprite itemFromNormalSprite:menupic4 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen4 setTag:29];
    CCSprite* menupic5 = [CCSprite spriteWithFile:@"30.png"];
    
    CCMenuItemSprite *spmen5 = [CCMenuItemSprite itemFromNormalSprite:menupic5 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen5 setTag:30];
    
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,spmen4,spmen5, nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 150)];
    
    [self addChild:menu];
}

-(void)makebutton7
{
    CCSprite* menupic = [CCSprite spriteWithFile:@"31.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen1 setTag:31];
    
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"32.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen2 setTag:32];
    
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"33.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen3 setTag:33];
    
    CCSprite* menupic4 = [CCSprite spriteWithFile:@"34.png"];
    
    CCMenuItemSprite *spmen4 = [CCMenuItemSprite itemFromNormalSprite:menupic4 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen4 setTag:34];
    
    CCSprite* menupic5 = [CCSprite spriteWithFile:@"35.png"];
    
    CCMenuItemSprite *spmen5 = [CCMenuItemSprite itemFromNormalSprite:menupic5 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen5 setTag:35];
    
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,spmen4,spmen5, nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 90)];
    
    [self addChild:menu];
}

-(void)makebutton8
{
    CCSprite* menupic = [CCSprite spriteWithFile:@"36.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen1 setTag:36];
    
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"37.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    [spmen2 setTag:37];
    
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"38.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    [spmen3 setTag:38];
    
    CCSprite* menupic4 = [CCSprite spriteWithFile:@"39.png"];
    
    CCMenuItemSprite *spmen4 = [CCMenuItemSprite itemFromNormalSprite:menupic4 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen4 setTag:39];
    CCSprite* menupic5 = [CCSprite spriteWithFile:@"40.png"];
    
    CCMenuItemSprite *spmen5 = [CCMenuItemSprite itemFromNormalSprite:menupic5 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
    
    [spmen5 setTag:40];
    
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,spmen4,spmen5, nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 30)];
    
    [self addChild:menu];
}

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
//        
//        CCSprite* sp = [CCSprite spriteWithFile:@"1.jpg"];
//        
//        sp.position = ccp(160, 240);
//        
//        [self addChild:sp];
        
        [self makebutton1];
        [self makebutton2];
        [self makebutton3];
        [self makebutton4];
        [self makebutton5];
        [self makebutton6];
        [self makebutton7];
        [self makebutton8];

        
    }
    
    return self;
}

@end
